<?php

namespace App\Http\Controllers\User;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Model\User;

/**
 * Class UserController
 * @package App\Http\Controllers\User
 * @User wuqin
 * @Date 2018/4/13 0013
 * @Time 11:36
 */
class UserController extends Controller
{
    /**
     * 方法 : index
     * @User wuqin
     * @DateTime 2018-04-13 11:36
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function index()
    {
        $user = session('user_info');
        if (empty($user))
            return $this->error_url('/', '请重新登录', 3);
//        dd($user);
        return view('User.index', ['user' => $user]);
    }

    /**
     * 方法 : balance
     * @User wuqin
     * @DateTime 2018-04-13 11:36
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function balance()
    {
        $user = session('user_info');
        if (empty($user))
            return $this->error_url('/', '请重新登录', 3);
        $userModel = new User();
        $user = $userModel->find($user["user_id"]);
        $data["user"] = $user->toArray();
        return view("User.balance", $data);
    }
}
